home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / perl / os2perl / write.t < prev   
Text File  |  1991-04-12  |  2KB  |  130 lines

  1. #!./perl
  2.  
  3. # $Header: write.t,v 4.0 91/03/20 01:55:34 lwall Locked $
  4.  
  5. print "1..3\n";
  6.  
  7. format OUT =
  8. the quick brown @<<
  9. $fox
  10. jumped
  11. @*
  12. $multiline
  13. ^<<<<<<<<<
  14. $foo
  15. ^<<<<<<<<<
  16. $foo
  17. ^<<<<<<...
  18. $foo
  19. now @<<the@>>>> for all@|||||men to come @<<<<
  20. 'i' . 's', "time\n", $good, 'to'
  21. .
  22.  
  23. open(OUT, '>Op.write.tmp') || die "Can't create Op.write.tmp";
  24.  
  25. $fox = 'foxiness';
  26. $good = 'good';
  27. $multiline = "forescore\nand\nseven years\n";
  28. $foo = 'when in the course of human events it becomes necessary';
  29. write(OUT);
  30. close OUT;
  31.  
  32. $right =
  33. "the quick brown fox
  34. jumped
  35. forescore
  36. and
  37. seven years
  38. when in
  39. the course
  40. of huma...
  41. now is the time for all good men to come to\n";
  42.  
  43. if (`cat Op.write.tmp` eq $right)
  44.     { print "ok 1\n"; unlink 'Op.write.tmp'; }
  45. else
  46.     { print "not ok 1\n"; }
  47.  
  48. format OUT2 =
  49. the quick brown @<<
  50. $fox
  51. jumped
  52. @*
  53. $multiline
  54. ^<<<<<<<<< ~~
  55. $foo
  56. now @<<the@>>>> for all@|||||men to come @<<<<
  57. 'i' . 's', "time\n", $good, 'to'
  58. .
  59.  
  60. open(OUT2, '>Op.write.tmp') || die "Can't create Op.write.tmp";
  61.  
  62. $fox = 'foxiness';
  63. $good = 'good';
  64. $multiline = "forescore\nand\nseven years\n";
  65. $foo = 'when in the course of human events it becomes necessary';
  66. write(OUT2);
  67. close OUT2;
  68.  
  69. $right =
  70. "the quick brown fox
  71. jumped
  72. forescore
  73. and
  74. seven years
  75. when in
  76. the course
  77. of human
  78. events it
  79. becomes
  80. necessary
  81. now is the time for all good men to come to\n";
  82.  
  83. if (`cat Op.write.tmp` eq $right)
  84.     { print "ok 2\n"; unlink 'Op.write.tmp'; }
  85. else
  86.     { print "not ok 2\n"; }
  87.  
  88. eval <<'EOFORMAT';
  89. format OUT2 =
  90. the brown quick @<<
  91. $fox
  92. jumped
  93. @*
  94. $multiline
  95. ^<<<<<<<<< ~~
  96. $foo
  97. now @<<the@>>>> for all@|||||men to come @<<<<
  98. 'i' . 's', "time\n", $good, 'to'
  99. .
  100. EOFORMAT
  101.  
  102. open(OUT2, '>Op.write.tmp') || die "Can't create Op.write.tmp";
  103.  
  104. $fox = 'foxiness';
  105. $good = 'good';
  106. $multiline = "forescore\nand\nseven years\n";
  107. $foo = 'when in the course of human events it becomes necessary';
  108. write(OUT2);
  109. close OUT2;
  110.  
  111. $right =
  112. "the brown quick fox
  113. jumped
  114. forescore
  115. and
  116. seven years
  117. when in
  118. the course
  119. of human
  120. events it
  121. becomes
  122. necessary
  123. now is the time for all good men to come to\n";
  124.  
  125. if (`cat Op.write.tmp` eq $right)
  126.     { print "ok 3\n"; unlink 'Op.write.tmp'; }
  127. else
  128.     { print "not ok 3\n"; }
  129.  
  130.